#!/usr/bin/env python

# Considering natural numbers of the form, ab, where a, b  100, what is the maximum digital sum?

def power_pair_digits_sum(a, b):
    return sum( [ int(c) for c in str(a ** b)] )

max = 0

if __name__ == "__main__":
    for a in range(1, 100):
        for b in range(1, 100):
            x = power_pair_digits_sum(a, b)
            if x > max:
                max = x
    print max
